package org.scirp.ijmis.service.review.impl;

import java.util.List;

import org.scirp.ijmis.dao.personpaper.IPaperDAO;
import org.scirp.ijmis.dao.review.IReleasedCommentDAO;
import org.scirp.ijmis.po.personpaper.Paper;
import org.scirp.ijmis.po.review.ReleasedComment;
import org.scirp.ijmis.service.review.IReleasedCommentService;

public class ReleasedCommentService implements IReleasedCommentService {
	private IReleasedCommentDAO releasedCommentDAO;
	private IPaperDAO paperDAO;

	public void setReleasedCommentDAO(IReleasedCommentDAO releasedCommentDAO) {
		this.releasedCommentDAO = releasedCommentDAO;
	}

	public IReleasedCommentDAO getReleasedCommentDAO() {
		return releasedCommentDAO;
	}

	public IPaperDAO getPaperDAO() {
		return paperDAO;
	}

	public void setPaperDAO(IPaperDAO paperDAO) {
		this.paperDAO = paperDAO;
	}

	public List<ReleasedComment> selectAll() {
		return releasedCommentDAO.selectAll();
	}

	public ReleasedComment selectById(Object id) {
		return releasedCommentDAO.selectById(id);
	}

	public boolean updateReleasedComment(ReleasedComment releasedComment, Paper paper) {
		return (paperDAO.updatePaper(paper)) && (releasedCommentDAO.updateReleasedComment(releasedComment));
	}

	public Long saveReleasedComment(ReleasedComment releasedComment, Paper paper) {
		Long pid = 0L;
		if (paperDAO.updatePaper(paper)) {
			pid = releasedCommentDAO.saveReleasedComment(releasedComment);
		}
		return pid;
	}

	public ReleasedComment selectByPaperIdAndPersonId(Long paperId, Long personId) {
		return releasedCommentDAO.selectByPaperIdAndPersonId(paperId, personId);
	}

	public List<ReleasedComment> selectByPaperId(Long paperId) {
		return releasedCommentDAO.selectByPaperId(paperId);
	}

	public boolean deleteReleasedComment(Long releasedCommentId) {
		return releasedCommentDAO.deleteReleasedComment(releasedCommentId);
	}

}
